<?php







basename($_SERVER["PHP_SELF"]) == 'inc.member.php' && exit('Invalid Access!');















require_once(preg_replace('/members$/', '', dirname(__FILE__))."inc.config.php");















$_error_report_code = $vars["debug"]? (E_ALL - E_NOTICE) : 0;







error_reporting($_error_report_code);















session_start();







require_once(M_ROOT."/functions/common/common.php");







require_once(M_ROOT."/functions/general_function.php");







require_once(M_ROOT."/functions/downline/downline_function.php");







require_once(M_ROOT."/functions/comm/comm_function.php");







require_once(M_ROOT."/functions/category/category_function.php");







require_once(M_ROOT."/functions/product/product_function.php");







require_once(M_ROOT."/functions/forms/forms_function.php");







require_once(M_ROOT."/functions/search/search_function.php");







require_once(M_ROOT."/e.dbv.php");







require_once(M_ROOT."/initialize.php");







initialize();







$vars["this_file"]=$this_file=basename($_SERVER["PHP_SELF"]);







$vars["member_title"]=replace_tag(__("<%title%> Member Area"), array("<%title%>"=>__($vars["title"])));







$inputbox_style=USER_BROWSER=='msie'? "class='inputbox' style=\"width:98%;\"" : "class='inputbox' style=\"width:100%;\"";







verify_user_sess_data();







$uid=$_SESSION['uid'];



$dist_code=$_SESSION['dist_code'];



$r_user=get_user_detail_by_id($uid);















$settings = get_settings('maintenance,maintenance_msg');







if($settings['maintenance'] == 'y'){







	print format_member_page($settings['maintenance_msg'], $vars['member_title'], $vars['member_title']);







	exit;







}















/*##### FORM POST/GET #####*/







if(count($_POST)){$posting=1; $temp=get_post(); $post_a=$temp["post_a"]; $post_s=$temp["post_s"]; $post_d=$temp["post_d"]; $post_h=$temp["post_h"];}







if(count($_GET)){$getting=1; $temp=get_get(); $get_a=$temp["get_a"]; $get_s=$temp["get_s"]; $get_d=$temp["get_d"]; $get_h=$temp["get_h"];}















function format_member_page($content, $title, $content_title, $head_info="", $keyword="", $gzip=true){







global $vars, $uid, $r_user, $dist_code;







$db=$vars["db"];















$r_status_d=array("normal"=>__("Normal"),"unverified"=>__("Unverified"),"suspended"=>__("Suspended"),"terminated"=>__("Terminated"));







$r_yesno_d=array("y"=>__("Yes"), "n"=>__("No"));















//open file







$tpl=file_get_contents(TEMPLATE_PATH. "/". $vars["template"] . "/member.htm");















$this_year = ndate('Y');







$this_month = ndate('n');







$this_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$this_year' and month='$this_month'"), 0);







$member_info=







"Account ID: $r_user[code] Name: $r_user[name]<br />$vars[ewallet_title]: ".number_format($r_user['ewallet'], 2)." This Month Maintenance: ".number_format($this_month_maintain, 2)." Accumulated Maintenance: ".number_format($r_user['swallet'], 2);















//account info







ob_start();







?>







<table width="250">







	<tr>







		<td width="70" height="30"><?php echo __("Member ID") ?>:</td>







		<td height="30"><?php echo $r_user['code']; ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("User Name") ?>:</td>







		<td height="30"><?php echo $r_user['username']; ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("Name") ?>:</td>







		<td height="30"><?php echo $r_user['name']; ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("Rank") ?>:</td>







		<td height="30"><?php echo ($r_user["rank_a"]? __($vars['rank_index_a_d'][$r_user["rank_a"]]) : __("None")); ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("Status") ?>:</td>







		<td height="30"><?php echo __($r_status_d[$r_user["status"]]); ?></td>







	</tr>







</table>







<?php







$account_info = ob_get_clean();
$right_panel = ob_get_clean();


$this_year = ndate('Y');





$this_month = ndate('n');







$this_month_starttime = mktime(0,0,0,ndate('n'),1,ndate('Y'));







$this_month_endtime = mktime(23,59,59,ndate('n')+1,0,ndate('Y'));







$this_month_start = date("Y-m-d H:i:s", $this_month_starttime);







$this_month_end = date("Y-m-d H:i:s", $this_month_endtime);







$last_month_time = mktime(0,0,0,$this_month-1,1,$this_year);







$last_year = date('Y', $last_month_time);







$last_month = date('n', $last_month_time);







$next_month_time = mktime(0,0,0,$this_month+1,1,$this_year);







$next_year = date('Y', $next_month_time);







$next_month = date('n', $next_month_time);







$last_month_starttime = mktime(0,0,0,$this_month-1,1,ndate('Y'));







$last_month_endtime = mktime(23,59,59,$this_month,0,ndate('Y'));







$last_month_start = date("Y-m-d H:i:s", $last_month_starttime);







$last_month_end = date("Y-m-d H:i:s", $last_month_endtime);







$this_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$this_year' and month='$this_month'"), 0);







$last_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$last_year' and month='$last_month'"), 0);







$next_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$next_year' and month='$next_month'"), 0);







$this_month_maintain_sales = calc_personal_sales($uid, $this_month_start, $this_month_end);







$last_month_maintain_sales = calc_personal_sales($uid, $last_month_start, $last_month_end);







ob_start();







?>







<table>







	<tr>







		<td height="30"><?php echo __("e-Wallet Account Balance") ?>:</td>







		<td height="30"><?php echo number_format($r_user['ewallet'], 2); ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("e-Register Account Balance") ?>:</td>







		<td height="30"><?php echo number_format($r_user['eswallet'], 2); ?></td>







	</tr>







	<tr>







		<td width="190" height="30"><?php echo __("e-Chip Account Balance") ?>:</td>







		<td height="30"><?php echo number_format($r_user['swallet'], 2); ?></td>







	</tr>







	<tr>







		<td width="190" height="30"><?php echo __("e-Voucher Account Balance") ?>:</td>







		<td height="30"><?php echo number_format($r_user['mwallet'], 2); ?></td>







	</tr>







	<tr>







		<td height="30"><?php echo __("Last Login") ?>:</td>







		<td height="30"><?php echo ($r_user["last_login2"]=="0000-00-00 00:00:00"? __("Never") : date($vars["date_format"], strtotime($r_user["last_login2"]))); ?></td>







	</tr>
	
		
		
		<?php /*







	<tr>







		<td>Next Month Maintenance:</td>







		<td><?php echo number_format($next_month_maintain, 2); ?></td>







	</tr>







	<tr>







		<td>Last Month Maintenance:</td>







		<td><?php echo number_format($last_month_maintain, 2); ?></td>







	</tr>







	<tr>







		<td>Last Month Maintenance + Sales:</td>







		<td><?php echo number_format($last_month_maintain_sales, 2); ?></td>







	</tr>*/ ?>







</table>







<?php







$account_point = ob_get_clean();















//inbox







$unread = @mysql_result(mysql_query($s="select count(*) from $db->messaging where to_type='u' and to_uid='$uid' and to_deleted='n' and to_read='n'"), 0) or 0;







//for SLG group



$new_stockist_plan = false;



$old_stockist_plan = false;







$slg_dist=mysql_fetch_assoc(mysql_query("select a.id from $db->users a inner join $db->users b on a.ref_left between b.ref_left and b.ref_right and b.id='17574' where a.id=".$uid));







if($slg_dist['id']>0){



	$stockist=mysql_fetch_assoc(mysql_query("select count(*) as ttl from $db->users where stockist_uid=".$uid));



	if($stockist['ttl']>0){



		$old_stockist_plan = true;



	}



	



	$new_plan=mysql_fetch_assoc(mysql_query("select id from $db->stockist_access where udate='0000-00-00' and uid=".$uid));



	if($new_plan['id']>0){



		$new_stockist_plan = true;



	}



}

$msg=mysql_fetch_assoc(mysql_query("select count(*) as ttl from $db->messaging where to_read='n' and to_uid=".$uid));

if($msg['ttl']>0){
	$ttl_msg = " (".$msg['ttl'].")";
}else{
	$ttl_msg = "";
}

$welcome_msg = replace_tag(__("<%name%>, welcome to <%title%>."), array("<%name%>"=>$r_user['name'], "<%title%>"=>$vars["title"]));




$member_menu=

"<li class='dropdown''><a href='<%murl_index%>'>".__("Home")."</a></li>

<li class='dropdown''><a href='<%murl_profile%>'>".__("Profile")."</a></li>

<li class='dropdown''><a href='<%murl_network%>'>".__("Genealogy")."</a></li>

<li class='dropdown''><a href='<%murl_register%>'>".__("Register")."</a></li>

<li class='dropdown''><a href='<%murl_withdrawal%>'>".__("e-Account")."</a></li>

<li class='dropdown''><a href='<%murl_sales_list%>'>".__("Sales")."</a></li>

<li class='dropdown''><a href='<%murl_commission%>'>".__("Commission Report")."</a></li>

<li class='dropdown''><a href='<%murl_cash_flow_program%>' class='buttons'>".__("Voucher Market")."</a></li>

<li class='dropdown''><a href='<%murl_upload_file%>' class='buttons'>".__("Upload File")."</a></li>

<li class='dropdown''><a href='<%murl_company_bank_info%>' class='buttons'>".__("Bank Details")."</a></li>

<li class='dropdown''><a href='<%murl_support%>' class='buttons'>".__("Support").$ttl_msg."</a></li>

<li class='dropdown''><a href='<%murl_logout%>'>".__("Logout")."</a></li>";
    
$member_menu=

"<li><a href='<%murl_index%>'>".__('Home')."</a></li>
                <li><a href='javascript:;'>".__('Personal')."</a>
                    <ul>
                        <li><a href='<%murl_profile%>'>".__('Profile')."</a></li>
                        <li><a href='<%murl_profile%>?p=1'>".__('Password')."</a></li>
                        <li><a href='<%murl_profile%>?p=2'>".__('AuthCode')."</a></li>
                    </ul>
                </li>
                <li><a href='javascript:;'>".__('Business')."</a>
                    <ul>
                        <li><a href='<%murl_register%>'>".__('SignUp')."</a></li>
                        <li><a href='<%murl_activate%>'>".__('Purchase')."</a></li>
                        <li><a href='<%murl_sales_list%>'>".__('Purchase History')."</a></li>
                        <!--<li><a href=''>".__('Group Sales')."</a></li>-->
                    </ul>
                </li>
                <li><a href='javascript:;'>".__('Credit')."</a>
                    <ul>
                        <li><a href='<%murl_ewallet_transfer%>'>".__('Transfer BP')."</a></li>
                        <li><a href='<%murl_eswallet_transfer%>'>".__('Transfer SP')."</a></li>
                        <li><a href='<%murl_mwallet_transfer%>'>".__('Transfer TP')."</a></li>
                        <li><a href='<%murl_e_to_m%>'>".__('Convert BP to TP')."</a></li>";

if($r_user['convert_bp']==1){
$member_menu.="<li><a href='<%murl_e_to_es%>'>".__('Convert BP to SP')."</a></li>";
}
if($r_user['convert_tp']==1){
$member_menu.="<li><a href='<%murl_m_to_es%>'>".__('Convert TP to SP')."</a></li>";
}

$member_menu.="
                        <li><a href='<%murl_withdrawal%>'>".__('Withdrawal')."</a></li>
                        <li><a href='<%murl_withdrawal_history%>'>".__('Withdrawal Status')."</a></li>
                        <li><a href='<%murl_ewallet_history%>'>".__('BP History')."</a></li>
                        <li><a href='<%murl_eswallet_history%>'>".__('SP History')."</a></li>
                        <li><a href='<%murl_mwallet_history%>'>".__('TP History')."</a></li>
                        <li><a href='<%murl_twallet_history%>'>".__('AP History')."</a></li>
                        <li><a href='<%murl_cwallet_history%>'>".__('RP History')."</a></li>
                        </li>
                    </ul>
                </li>
                <li class=''><a href='javascript:;'>".__('Paradigm')."</a>
                    <ul style='visibility: hidden;'>
                        <li><a href='<%murl_genealogy%>'>".__('Sponsor Paradigm')."</a>
                        </li>
                        <li><a href='<%murl_network%>'>".__('Placement Paradigm')."</a></li>
                    </ul>
                </li>
                <li><a href='javascript:;'>".__('Bonus')."</a>
                    <ul>
                        <!--<li><a href=''>".__('ROI')."</a></li>
                        <li><a href=''>".__('ROI Details')."</a></li>-->
                        <li><a href='<%murl_commission%>'>".__('Bonus Report')."</a></li>
                    </ul>
                </li>
                <li><a href='javascript:;'>".__('News & Messages')."</a>
                    <ul>
                        <li><a href='<%murl_support%>'>".__('Contact Us')."</a></li>
                        <li><a href='<%murl_annoucement%>'>".__('Annoucement & News')."</a></li>
                        <li><a href='<%murl_exchange_rate%>'>".__('Exchange Rate')."</a></li>

                    </ul>
                </li>
                <li><a href='<%murl_logout%>'>".__('Logout')."</a></li>";








$link = '';

/*

if($r_user['country']=='MY'){



	$link="<table>



			<tr><td><a onclick='window.open(\"http://cn.gfi2u.com/download/GFI_Product_Price_List.pdf\",\"pricelist\")'>Product Price List [click to view]</a></td></tr>



			<tr><td><a onclick='window.open(\"http://cn.gfi2u.com/download/Shampoo_Price_List.pdf\",\"pricelist\")'>Shampoo Price List [click to view]</a></td></tr>



			</table>";



}

*/

//replace tag


// #############################    Right Panel     #####################################
$over_30_days = @mysql_result(mysql_query("select value from $db->settings where param='over_30_days'"), 0);
$result1 = @mysql_result(mysql_query("select value from $db->settings where param='result1'"), 0);
$result2 = @mysql_result(mysql_query("select value from $db->settings where param='result2'"), 0);
$result3 = @mysql_result(mysql_query("select value from $db->settings where param='result3'"), 0);
$result4 = @mysql_result(mysql_query("select value from $db->settings where param='result4'"), 0);
$result5 = @mysql_result(mysql_query("select value from $db->settings where param='result5'"), 0);
$day1 = @mysql_result(mysql_query("select value from $db->settings where param='day1'"), 0);
$day2 = @mysql_result(mysql_query("select value from $db->settings where param='day2'"), 0);
$day3 = @mysql_result(mysql_query("select value from $db->settings where param='day3'"), 0);
$day4 = @mysql_result(mysql_query("select value from $db->settings where param='day4'"), 0);
$day5 = @mysql_result(mysql_query("select value from $db->settings where param='day5'"), 0);
$arbs = @mysql_result(mysql_query("select value from $db->settings where param='arbs'"), 0);
$all_profit = @mysql_result(mysql_query("select value from $db->settings where param='all_profit'"), 0);
$investor_profit = @mysql_result(mysql_query("select value from $db->settings where param='investor_profit'"), 0);
$company_profit = @mysql_result(mysql_query("select value from $db->settings where param='company_profit'"), 0);
$expenses = @mysql_result(mysql_query("select value from $db->settings where param='expenses'"), 0);
$fund_increase = @mysql_result(mysql_query("select value from $db->settings where param='fund_increase'"), 0);
$expenses = @mysql_result(mysql_query("select value from $db->settings where param='expenses'"), 0);
$result_date = @mysql_result(mysql_query("select value from $db->settings where param='result_date'"), 0);
$purchase = @mysql_fetch_assoc($r=mysql_query("SELECT a.refno,a.cdate,b.title FROM $db->purchase a INNER JOIN $db->purchase_detail b ON b.slid=a.id WHERE a.uid='".$uid."' and a.status='confirmed'"));


    $right_panel = "<table width='100%' border='0'>
    <tbody>
    <tr bgcolor='#CCCCCC' valign='top' align='center'>
    <td>
    <style>
        div#clocknow {
            width: 250px;
            text-align: left;
            font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
            font-size: 12px;
            color: #000000;
            font-weight: bold;
        }
    </style>
    <div id='clocknow'>
        <span id='liveclock'>9.7.2014 7:25:42 上午</span>
        <script type='text/javascript'>
            function liveclock() {
                if (!document.all && !document.getElementById)
                    return
                var am = '上午';
                var pm = '下午';
                thelement = document.getElementById ? document.getElementById('liveclock') : document.all.liveclock;
                var d = new Date();
                var s = d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear() + ' ' + (d.getHours() % 12 == 0 ? 12 : d.getHours() % 12) + ':' + (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':' + (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()) + ' ' + (d.getHours() < 12 ? am : pm);
                thelement.innerHTML = s;
                setTimeout('liveclock()', 1000);
            }
            liveclock();
        </script>
    </div>


    <br>


    <table width='100%' border='0' cellpadding='10' cellspacing='0'>
        <tbody>
        <tr>
            <td class='title01'>
                <img src='/images/ironmenfx/head.png' width='74' height='82' border='0' align='middle'>
                <strong>".__('Welcome')." <a class='title01' style='text-decoration:none;' href='<%murl_profile%>'>".$r_user['username']."</a></strong>
            </td>
        </tr>
        <tr>
            <td width='67%' class='text1'>

                <table width='260'>
                    <tbody>
                    <tr>
                        <td class='text1'><strong>".__('Member No.')."</strong></td>
                        <td class='text1' width='10' align='right'><strong>:</strong></td>
                        <td class='text1' width='120' align='right'>".$r_user['username']."</td>
                    </tr>
                    <tr>
                        <td class='text1'><strong>".__('Join Date')."</strong></td>
                        <td class='text1' width='10' align='right'><strong>:</strong></td>
                        <td class='text1' width='120' align='right'>".date('Y-m-d', strtotime($r_user['cdate']))."</td>
                    </tr>
                    <tr>
                        <td class='text1'><strong>".__('Rank')."</strong></td>
                        <td class='text1' width='10' align='right'><strong>:</strong></td>
                        <td class='text1' width='120' align='right'>".($r_user["rank_a"]? __($vars['rank_index_a_d'][$r_user["rank_a"]]) : __("None"))."</td>
                    </tr>

                    </tbody>
                </table>
            </td>
        </tr>
        </tbody>
    </table>


    <style>
        .clocknow {
            font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
            font-size: 12px;
            color: #000000;
            font-weight: bold;
        }
    </style>
    <table width='260'>
        <tbody>
        <tr>
            <td class='text1' width='75'><strong>".__('Last Visit')."</strong></td>
            <td class='text1' width='5' align='right'><strong>:</strong></td>
            <td class='clocknow' width='180' align='right'>".$r_user['last_login']."</td>
        </tr>
        </tbody>
    </table>

    <br>


    <link rel='stylesheet' href='/images/ironmenfx/li-scroller.css'>
    <script src='/images/ironmenfx/jquery-1.7.js'></script>
    <script type='text/javascript' src='/images/ironmenfx/jquery.li-scroller.1.0.js'></script>
    <script type='text/javascript'>
        $(function() {
            $('ul#ticker01').liScroll({travelocity: 0.03});
        });
    </script>


    <div class='tickercontainer1'>
        <div class='mask'>
            <ul id='ticker01' class='newsticker' style='width: 943px; left: 98.04000000000002px;'>

                <li><span>5.7.2014</span><a href='#'>股票认购</a>
                </li>

                <li><span>30.6.2014</span><a
                        href='#'>股票签约仪式</a></li>

                <li><span>14.6.2014</span><a
                        href='#'>购买上市公司股</a></li>

                <li><span>24.5.2014</span><a href='#'>万事达卡</a>
                </li>

            </ul>
        </div>
    </div>


    <br>


    <link href='/images/ironmenfx/mystyle.css' rel='stylesheet' type='text/css'>
    <style type='text/css'>
        <!--
        .style1 {
            color: #000000;
            font-size: 36px;
        }

        -->
    </style>



    <br>


    <div>
        <div>".__('USD/CNY 1 Day')."</div>
        <img border='0' width=239 height=200 alt='GBP/CNY 1 Day' src='http://asia.advfn.com/p.php?pid=staticchart&s=FX%5EUSDCNY&t=37&p=0&dm=0&vol=0&width=239&height=200&min_pre=0&min_after=0'>
    </div>


    <br>


    <link href='/images/ironmenfx/jquery.countdown.css' rel='stylesheet' type='text/css'>
    <script type='text/javascript' src='/images/ironmenfx/jquery.countdown.js'></script>
    <script type='text/javascript' src='/images/ironmenfx/jquery.countdown-zh-CN.js'></script>

    </td>
    </tr>
    </tbody>
    </table>";


// #############################    ~ End Right Panel End ~     #####################################




$page=replace_tag($tpl, array(







"<%title%>"=>$title,







"<%charset%>"=>$vars["charset"],







"<%meta_title%>"=>$vars["meta_title"],







"<%meta_desc%>"=>$vars["meta_desc"],







"<%meta_keyw%>"=>$vars["meta_keyw"].($keyword? " $keyword" : ""),







"<%head_info%>"=>$head_info,







"<%template_url%>"=>TEMPLATE_URL . "/$vars[template]",







"<%js_url%>"=>JS_URL,







"<%url_home%>"=>M_URL,







"<%member_info%>"=>$member_info,



"<%welcome_msg%>"=>$welcome_msg,



"<%member_menu%>"=>$member_menu,







"<%news%>"=>@file_get_contents(M_ROOT.'/'.$vars['file']['public']['news_short']),







"<%content_header%>"=>$content_title,







"<%account_info%>"=>$account_info,
"<%right_panel%>"=>$right_panel,







"<%account_point%>"=>$account_point,







"<%content%>"=>$content,







"<%link%>"=>$link,







"<%copy_year%>"=>intval(ndate('Y'))>2009? '2009 - '.ndate('Y') : ndate('Y')));















//replace file







foreach($vars["file"]["public"] as $file=>$fname){







 $page=str_replace("<%purl_$file%>", M_URL."/".$fname, $page);







}







foreach($vars["file"]["member"] as $file=>$fname){







 $page=str_replace("<%murl_$file%>", MEMBER_URL."/".$fname, $page);







}















//replace language







$page=preg_replace('/_%(.+)%_/e', "__('\$1')", $page);







$page=preg_replace('/<%(.+_title)%>/e', "__(\$vars['\$1'])", $page);















//compression







if(!headers_sent()){







 header("Content-Type:text/html; charset=$vars[charset]");







 $encodings=array();







 if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))







  $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));















 if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {







  $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";







 }







}















if($enc && $vars["gzip"] && $gzip && !headers_sent()){







 header("Vary: Accept-Encoding");  // Handle proxies







 header('Content-Encoding: '.$enc);







 header("Expires: " . date("r", time()-10000));







 $page = gzencode($page, 7, FORCE_GZIP);







}















return $page;







}








?>